package com.rabbiter.em.controller.pay;


import com.rabbiter.em.common.Result;
import com.rabbiter.em.service.PayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RequestMapping("/api/ali_pay")
@RestController
public class PayController {

    @Resource
    private PayService payService;

    @GetMapping(value="/page")
    public Result getPayPage(@RequestParam("order_no")String orderNo,
                             @RequestParam("user_id") Long userId) {
        return payService.generatePayPage(orderNo, userId);
    }

    @GetMapping(value="/query")
    public Result query(@RequestParam("out_trade_no")String outTradeNo,
                        @RequestParam("trade_no") String tradeNo) {
        return payService.query(outTradeNo, tradeNo);
    }
}
